package com.lbmb.mdps.workbench.service.impl;

import com.lbmb.mdps.commons.domain.ThirdPartVo;
import com.lbmb.mdps.commons.domain.WarehouseVo;
import com.lbmb.mdps.workbench.dao.ThirdPartyDao;
import com.lbmb.mdps.workbench.domain.ThirdParty;
import com.lbmb.mdps.workbench.domain.Warehouse;
import com.lbmb.mdps.workbench.service.ThirdPartService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 林文塨
 * @date 2022-06-02 1:39
 * description
 */
@Service("thirdPartService")
public class ThirdPartServiceImpl implements ThirdPartService {

    @Resource
    private ThirdPartyDao thirdPartyDao;

    @Override
    public List<ThirdPartVo> getAllThirdPart() {
        /*
         * 获得全部仓库
         * @author 林文塨
         * @date 2022/6/1 1:30
         * @param []
         * @return java.util.List<com.lbmb.mdps.commons.domain.WarehouseVo>
         */
        List<ThirdParty> thirdPartyList = thirdPartyDao.getAllThirdPart();

        List<ThirdPartVo> thirdPartVoList = new ArrayList<>();

        for (ThirdParty thirdParty : thirdPartyList) {
            ThirdPartVo thirdPartVo = new ThirdPartVo();
            thirdPartVo.setLabel(thirdParty.getBuyer());
            thirdPartVo.setValue(thirdParty.getId());

            thirdPartVoList.add(thirdPartVo);
        }

        return thirdPartVoList;
    }
}
